Table Example

File: Table.cln

Introduction

You may be familiar with a feature of traditional spreadsheets - the table generator. This takes two sets of values and calculates a grid of results by using one equation calculated using corresponding elements from the two inputs. This is a special case of CleanSheet's Cog object.

Essentially the Cog object calculates the values of the table by reference to the corresponding row of Input A and the corresponding column of Input B.

Scenario

For this example a table of repayments on a mortgage has been generated given the initial value of the mortgage as a row array and the interest rate as a column array.

Click on any part of the sheet you need help with.

Layer 0

This layer shows the Cog object calculating the table of result. Note that the Cog object is defined so as to automatically adjust to different sizes of input array.

Layer 1

This layer has the same Cog object doing the same calculation, except that the size of the Cog result has been increased to allow for column and row headers and three equations have been added to the Cog object to copy across the headings from the inputs A and B.

Layer 2

The inputs are simple arithmetic series, so they can be generated using the ariseries function, this layer demonstrates how this is done.


This is an Input Table, used here to input the initial mortgage value.


This is an Input Table, used to input the interest rates.


This is a Cog object, this calculates all the values inside the table by reference to the rows of input A and the columns of input B.

The equation contained inside is

Area All Equation: pmt{A[0][dy]/12,20*12,B[dx][0],0,0}

This one equation is used to calculate the whole table.

Pmt is the function to calculate payments on loans and investments.

A[0][dy] is row dy from Input A

B[dx][0] is column dx from input B.

A[0][dy]/12 is the rate of interest per month

20*12 is the number of months the mortgage covers


This is an Output Table, used to display the result of the Cog object.